﻿@model HotelManageSystem.Models.ContractModel
@using System.Collections.Concurrent
@using HotelManageSystem.Models
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"> </script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"> </script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"> </script>
<link href= "@Url.Content("~/Content/TelerikGrid.css")"rel="stylesheet" type="text/css" />
<style>
    select
    {
        height: 24px;
        width: 90%;
    }
    input
    {
        height: 23px;
        width: 90%;
    }
    textarea
    {
        max-width: 90%;
        max-height: 50px;
        min-width: 90%;
        min-height: 50px;
        resize: none; 
    }
</style>
<script type="text/javascript">
    $(document).ready(function () {
        //让员工信息只读
        $("#ID").attr("readonly", "readonly");
        $("#Name").attr("readonly", "readonly");
        $("#Sex").attr("readonly", "readonly");
        //让日期选择文本框只读
        $(".t-picker-wrap>input").attr("readonly", "readonly");

        //点击返回按钮要将Contract/Index加载到content当中来
        //然后设置菜单session为Contract/Index
        $("#return").click(function () {
            $.get("Contract/Index", null, function (data) {
                $("#content").html(data);
            });
            $.post("HumanResources/SetSeesion", { u: "Contract/Index" }, function () { });
        });
    });
</script>
<div class="t-widget t-grid" style="width: 100%; height: 100%">
    @using (Html.BeginForm("Edit", "Contract", FormMethod.Post))
    {
        <div class="t-edit-form-container" style="width: 100%;">
            @Html.ValidationSummary(true)
            <fieldset style="width: 100%; border: 0px;">
                <legend style="font-size: 20px;">管理合同：</legend>
                <table width="100%">
                    @*工号、姓名、性别*@
                    <tr>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.ID)
                            </div>
                            <div class="editor-field">
                                @Html.EditorFor(model => model.ID)
                                @Html.ValidationMessageFor(model => model.ID)
                            </div>
                        </td>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.Name)
                            </div>
                            <div class="editor-field">
                                @Html.EditorFor(model => model.Name)
                                @Html.ValidationMessageFor(model => model.Name)
                            </div>
                        </td>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.Sex)
                            </div>
                            <div class="editor-field">
                                @Html.EditorFor(model => model.Sex)
                                @Html.ValidationMessageFor(model => model.Sex)
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.ContractType)
                            </div>
                            <div class="editor-field">
                                @Html.DropDownListFor(model => model.ContractType
                                   , new[]
                                         {
                                             new SelectListItem(){Text="劳动合同",Value="劳动合同",Selected = Model.Sex=="劳动合同"}, 
                                             new SelectListItem(){Text="试用合同",Value="试用合同",Selected = Model.Sex=="试用合同"}, 
                                         })
                                @Html.ValidationMessageFor(model => model.ContractType)
                            </div>
                        </td>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.BeginContractDate)
                            </div>
                            <div class="editor-field">
                                @Html.EditorFor(model => model.BeginContractDate)
                                @Html.ValidationMessageFor(model => model.BeginContractDate)
                            </div>
                        </td>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.EndContractDate)
                            </div>
                            <div class="editor-field">
                                @Html.EditorFor(model => model.EndContractDate)
                                @Html.ValidationMessageFor(model => model.EndContractDate)
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="editor-label">
                                @Html.LabelFor(model => model.ContractRemark)
                            </div>
                            <div class="editor-field">
                                @Html.TextAreaFor(model => model.ContractRemark)
                                @Html.ValidationMessageFor(model => model.ContractRemark)
                            </div>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
        <p>
            <input type="submit" value="保存" style="height: 23px; width: 5%;" />
            <input type="button" value="返回" id="return" style="height: 23px; width: 5%;" />
        </p>
    }
</div>
